<!doctype html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <title>Document12</title>

    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/css/bootstrap.min.css" rel="stylesheet"
          crossorigin="anonymous"/>
</head>

<body>
<div class="container">
    <h2 class="page-header">Promise race方法</h2>
</div>

<script>

    let p1 = new Promise((resolve, reject) => {
        setTimeout(()=>{
            resolve(345);
        }, 1000)

    });
    // let p2 = Promise.resolve('success');
    let p2 = Promise.reject('fail');
    let p3 = Promise.resolve('Oh Yeah');
    const result = Promise.race([p1,p2,p3])
    console.log(result);

</script>

</body>
</html>
